home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / os2 / sio155.zip / SIOREF.TXT < prev    next >
Text File  |  1996-06-27  |  86KB  |  2,116 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.                                        SIO
  25.                            Technical Reference Manual
  26.  
  27.  
  28.  
  29.                      Copyright (c) 1995 by Raymond L. Gwinn
  30.                                 26 Tanager Place
  31.                           Beckley, West Virginia 25801
  32.                                All Rights Reserved
  33.  
  34.                                   June 26, 1996
  35.  
  36.  
  37.                               CompuServe: 71154,575
  38.                              InterNet: ray@gwinn.com
  39.                               Voice: 1-304-255-7900
  40.                                FAX: 1-303-255-7902
  41.                      BBS: 1-304-255-7903 or vmbbs.gwinn.com
  42.                             WEB http://www.gwinn.com
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.                                   INTRODUCTION
  66.  
  67.      Documentation of software is often more difficult than writing the
  68.      program itself (at least it is for this author).  I will do my best
  69.      though.
  70.  
  71.      But who do I document for?  The user that is setting up a BBS just
  72.      wants to get SIO installed and to move on to more important things. 
  73.      The user that is having problems needs information about serial I/O
  74.      communications in general and the PC specifically.  The application
  75.      developer (programmer) needs detailed information about each
  76.      individual function and the information generated.
  77.  
  78.      The answer is, more than one manual is needed.  This manual is
  79.      intended as a reference for use by application programmers that
  80.      desires to use SIO.  A separate Users Manual is included in the
  81.      distribution file(s).
  82.  
  83.      This manual and the software described is provided as is and with no
  84.      guarantees.  Use at your own risk.
  85.  
  86.  
  87.  
  88.  
  89.      ii
  90.  
  91.  
  92.      WHAT IS SIO . . . . . . . . . . . . . . . . . . . . . . . . . . .    1
  93.  
  94.      DISTRIBUTION, ORDERING AND SUPPORT  . . . . . . . . . . . . . . .    2
  95.           Distribution and Ordering  . . . . . . . . . . . . . . . . .    2
  96.                SIO Distribution and Support BBS  . . . . . . . . . . .    2
  97.            . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .    2
  98.                OS/2 Vendor Forum on
  99.                     CompuServe . . . . . . . . . . . . . . . . . . . .    2
  100.           Updates  . . . . . . . . . . . . . . . . . . . . . . . . . .    3
  101.  
  102.      Development and Debugging Tools . . . . . . . . . . . . . . . . .    4
  103.           The Poor Man's Line Monitor (PMLM.EXE) . . . . . . . . . . .    4
  104.           VIEWPMLM.EXE . . . . . . . . . . . . . . . . . . . . . . . .    5
  105.           SIO's Utility (SU.EXE) . . . . . . . . . . . . . . . . . . .    5
  106.                IRQs that currently free for use  . . . . . . . . . . .    5
  107.  
  108.      File System Requests  . . . . . . . . . . . . . . . . . . . . . .    6
  109.           Driver Initialization  . . . . . . . . . . . . . . . . . . .    6
  110.           Read . . . . . . . . . . . . . . . . . . . . . . . . . . . .    6
  111.           Input Status . . . . . . . . . . . . . . . . . . . . . . . .    6
  112.           Input Flush  . . . . . . . . . . . . . . . . . . . . . . . .    7
  113.           Write  . . . . . . . . . . . . . . . . . . . . . . . . . . .    7
  114.           Output Status  . . . . . . . . . . . . . . . . . . . . . . .    7
  115.           Output Flush . . . . . . . . . . . . . . . . . . . . . . . .    7
  116.           Open . . . . . . . . . . . . . . . . . . . . . . . . . . . .    7
  117.                Initial Open  . . . . . . . . . . . . . . . . . . . . .    7
  118.                Additional Open . . . . . . . . . . . . . . . . . . . .    8
  119.           Close  . . . . . . . . . . . . . . . . . . . . . . . . . . .    8
  120.                Intermediate Close  . . . . . . . . . . . . . . . . . .    8
  121.                Last Close  . . . . . . . . . . . . . . . . . . . . . .    8
  122.  
  123.      Device I/O Control (IOCtl) Commands . . . . . . . . . . . . . . .    9
  124.           IOCtl Functions From a DOS Session . . . . . . . . . . . . .   10
  125.           41h - Set Bit Rate . . . . . . . . . . . . . . . . . . . . .   11
  126.           42h - Set Line Characteristics . . . . . . . . . . . . . . .   12
  127.           43h - Extended Set Bit Rate  . . . . . . . . . . . . . . . .   13
  128.           44h - Transmit Byte Immediate  . . . . . . . . . . . . . . .   14
  129.           45h - Set Break Off  . . . . . . . . . . . . . . . . . . . .   14
  130.           46h - Set Modem Control Signals  . . . . . . . . . . . . . .   15
  131.           47h - Hold Transmit  . . . . . . . . . . . . . . . . . . . .   16
  132.           48h - Start Transmit . . . . . . . . . . . . . . . . . . . .   16
  133.           4Bh - Set Break on . . . . . . . . . . . . . . . . . . . . .   17
  134.           53h - Write Device Control Block (DCB)   . . . . . . . . . .   17
  135.           54h - Write Extended Mode Parameters . . . . . . . . . . . .   20
  136.           61h - Query Current Bit Rate . . . . . . . . . . . . . . . .   21
  137.           62h - Query Line Characteristics . . . . . . . . . . . . . .   21
  138.           63h - Query Extended Bit Rate  . . . . . . . . . . . . . . .   22
  139.           64h - Query SIO Status . . . . . . . . . . . . . . . . . . .   23
  140.           65h - Query Transmit Data Status . . . . . . . . . . . . . .   24
  141.           66h - Query Current Modem Output Control Signals . . . . . .   25
  142.           67h - Query Current Modem Input Signals  . . . . . . . . . .   25
  143.           68h - Query Number of Characters in Receive Buffer . . . . .   26
  144.           6Dh - Query SIO Error  . . . . . . . . . . . . . . . . . . .   27
  145.           72h - Query SIO Event Information  . . . . . . . . . . . . .   28
  146.  
  147.  
  148.  
  149.  
  150.                                                                         iii
  151.  
  152.           73h - Read Device Control Block (DCB)  . . . . . . . . . . .   29
  153.           74h - Read Enhanced Mode Parameters  . . . . . . . . . . . .   29
  154.  
  155.      Differences between SIO/VSIO and COM/VCOM . . . . . . . . . . . .   30
  156.  
  157.      Appendix A, Hardware Port and IRQ Assignments . . . . . . . . . .   31
  158.           Addresses and IRQs for COM1 and COM2 . . . . . . . . . . . .   31
  159.           Defacto standard for COM3 and COM4 . . . . . . . . . . . . .   31
  160.           Addresses and IRQ for COM3 through COM8 on the PS/2  . . . .   31
  161.  
  162.      Appendix B, SIO Chips . . . . . . . . . . . . . . . . . . . . . .   32
  163.           8250 . . . . . . . . . . . . . . . . . . . . . . . . . . . .   32
  164.           8250A  . . . . . . . . . . . . . . . . . . . . . . . . . . .   32
  165.           16450  . . . . . . . . . . . . . . . . . . . . . . . . . . .   33
  166.           16C451 . . . . . . . . . . . . . . . . . . . . . . . . . . .   33
  167.           16550 (Non A)  . . . . . . . . . . . . . . . . . . . . . . .   33
  168.           16550A . . . . . . . . . . . . . . . . . . . . . . . . . . .   33
  169.           16550AF  . . . . . . . . . . . . . . . . . . . . . . . . . .   33
  170.           16550AFN . . . . . . . . . . . . . . . . . . . . . . . . . .   33
  171.           16550s Made by Western Digital . . . . . . . . . . . . . . .   34
  172.           16C551 . . . . . . . . . . . . . . . . . . . . . . . . . . .   34
  173.           16C552 . . . . . . . . . . . . . . . . . . . . . . . . . . .   34
  174.           16C554 . . . . . . . . . . . . . . . . . . . . . . . . . . .   34
  175.           82510  . . . . . . . . . . . . . . . . . . . . . . . . . . .   34
  176.           16650  . . . . . . . . . . . . . . . . . . . . . . . . . . .   35
  177.           ComBic . . . . . . . . . . . . . . . . . . . . . . . . . . .   36
  178.  
  179.      Appendix C, Multi-Port Serial I/0 Cards . . . . . . . . . . . . .   37
  180.           Hayes ESP  . . . . . . . . . . . . . . . . . . . . . . . . .   37
  181.                ESP in Compatibility Mode . . . . . . . . . . . . . . .   37
  182.           Telcor Tport . . . . . . . . . . . . . . . . . . . . . . . .   37
  183.  
  184.      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   38
  185.           Gtek BBS550  . . . . . . . . . . . . . . . . . . . . . . . .   38
  186.           Neotech Quad Serial (MCA bus)  . . . . . . . . . . . . . . .   38
  187.  
  188.      Appendix D, Advanced SIO Options  . . . . . . . . . . . . . . . .   40
  189.           Protection . . . . . . . . . . . . . . . . . . . . . . . . .   40
  190.           Locked Baud Rate . . . . . . . . . . . . . . . . . . . . . .   40
  191.           IRQ Reflection to DOS Process  . . . . . . . . . . . . . . .   40
  192.           I/O Port Mapping to DOS Process  . . . . . . . . . . . . . .   40
  193.  
  194.      Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   41
  195.  
  196.  
  197.  
  198.  
  199.                                                                           1
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.                                    WHAT IS SIO
  218.  
  219.      SIO is a Serial Input/Output (SIO) communications character device
  220.      driver.  It provides an interface between application programs and the
  221.      serial communications hardware.
  222.  
  223.      SIO had been designed as a high performance replacement for the OS/2
  224.      device driver COM.SYS.  This manual documents the known differences
  225.      between COM.SYS and SIO.SYS.
  226.  
  227.      SIO only works with 8250 (type) serial I/O devices.  Such devices
  228.      include, but is not limited to the 8250A, 16450, 16550, 16550A and the
  229.      82510.  If you have a PC that is an IBM or near compatible which has a
  230.      serial communication port, it is likely that it contains one of these
  231.      devices.  SIO will identify the type of serial devices that it finds
  232.      at load time.
  233.  
  234.      Like other Device Drivers, SIO will do very little standing alone. 
  235.      There must be an application(s) program that makes use of SIO's
  236.      functions before one will benefit from the use of SIO.
  237.  
  238.  
  239.  
  240.  
  241.      2
  242.  
  243.                        DISTRIBUTION, ORDERING AND SUPPORT
  244.  
  245.      Distribution and Ordering
  246.  
  247.      The entire package collectively known as SIO is ShareWare.  It is not
  248.      free software or freeware.  See LICENSE.TXT and ORDER.TXT for
  249.      additional information.  The ShareWare version of SIO is distributed
  250.      electronically.  One may check their favorite electronic hangout for
  251.      the latest version of SIO.  The latest copy of the ShareWare version
  252.      is always posted for downloading from the BBS at 1-304-255-7903 or
  253.      vmbbs.gwinn.com and www.gwinn.com.
  254.  
  255.      Registered versions of SIO are distributed by US Mail and
  256.      electronically from the SIO Distribution and Support BBS.  Users
  257.      desiring to register electronically, may call the BBS and register on
  258.      line (1-304-255-7903 or vmbbs.gwinn.com) and www.gwinn.com, and
  259.      immediately download their registered version of SIO.  Use the ORDER
  260.      command at the main BBS prompt.
  261.  
  262.      Registrations/Orders can also be placed by phone, mail, FAX, and
  263.      email.  See the front cover of this manual for the phone numbers and
  264.      addresses.  Also see ORDER.TXT for and order form that may be used.
  265.  
  266.      Support
  267.      Extensive testing has been done to insure that this product works on
  268.      the widest possible range of OS/2 V2 (and up) systems.  In most cases,
  269.      problems can be resolved by reading this manual carefully.
  270.  
  271.      Support is provided in section 4 of the OS/2 Vendor Forum on
  272.      CompuServe (GO OS2BVEN).  Section 4 of the OS2BVEN Forum is dedicated
  273.      to the support of SIO.
  274.  
  275.      In addition, support is provided by BBS, Email and FAX.  Voice support
  276.      would overwhelm the author and is not available.  If, after reading
  277.      the manual carefully, you are unable to resolve a problem, you may
  278.      submit a problem report to one of the following: 
  279.                                       Email
  280.                               CompuServe 71154,575
  281.                              Internet ray@gwinn.com
  282.                                FAX 1-304-255-7902
  283.                       BBS 1-304-255-7903 or vmbbs.gwinn.com
  284.  
  285.      Users should note that Support does not always result in a correction
  286.      of a problem.  In addition, the support provided is support of SIO,
  287.      and not the applications that use SIO.  Questions and/or problems
  288.      about applications programs (such as terminal or FAX programs) should
  289.      be directed to the available support for the application.
  290.  
  291.  
  292.  
  293.  
  294.                                                                           3
  295.  
  296.  
  297.      Updates
  298.  
  299.      In general, updates/upgrades of SIO are free of charge for all
  300.      releases of SIO with the same major version number.  However, there
  301.      may be a handling charge if the user requires the upgrade to be mailed
  302.      or emailed.
  303.  
  304.      Registered users of SIO can update to the latest version FREE of
  305.      charge using the BBS and its UPDATE command.  Be sure to have your SIO
  306.      serial number when you first log onto the BBS.  All variations (number
  307.      of ports) of SIO are available for immediate download from the BBS by
  308.      registered users.
  309.  
  310.      Users that have a registered copy of SIO can also use REREG.EXE to
  311.      transfer the registration information to a new version of SIO.  Simply
  312.      unzip the new SIO files into a temporary directory, change to that
  313.      directory, execute REREG and answer the questions.  After doing the
  314.      above, all of the files in the temporary directory will have been
  315.      registered.  You must then copy all the SYS and EXE files from the
  316.      temporary directory to their normal directory (overlaying the old
  317.      registered version) or execute the SIO install program (INSTALL.EXE). 
  318.      Then you must reboot.  You may also want to check your CONFIG.SYS for
  319.      the path of the SIO/VSIO being loaded and make sure both the new ones
  320.      are being loaded.
  321.  
  322.      If REREG will not transfer your registration information from a
  323.      previous version of SIO to the new version, then an upgrade must be
  324.      ordered on disk or obtained from the support BBS.
  325.  
  326.  
  327.  
  328.  
  329.      4
  330.  
  331.                          Development and Debugging Tools
  332.  
  333.      The Poor Man's Line Monitor (PMLM.EXE)
  334.  
  335.      PMLM is basically of interest to developers of comm applications and
  336.      those providing technical support for those applications.  This SIO
  337.      utility is released largely (in self defense) in the hope that some
  338.      users can diagnose their own problems.  PMLM's feature of saving trace
  339.      information to disk will only work with registered and beta versions
  340.      of SIO.
  341.  
  342.      PMLM provides basic line monitoring for OS/2, DOS and Windows comm
  343.      programs.  All characters sent or received by application programs are
  344.      displayed in the upper portion of the screen.  Receive characters are
  345.      displayed as "white on blue" and transmitted characters are displayed
  346.      "yellow on violet".  Line signals, such as CTS are displayed as "dim
  347.      white on red" when turned off and "bright white on red" when turned
  348.      on.  In addition, a signals transition to OFF is displayed in lower
  349.      case and a signals transition to ON is displayed in upper case.
  350.  
  351.      Status information is displayed in the lower part of the screen.  A
  352.      bright white display means the signal is on, a dim white indicates
  353.      that the signal is off.  In addition, when bright,  Rxoff and Txoff
  354.      indicate the SIO has sent (Txoff) or received (Rxoff) an Xoff, and an
  355.      Xon is pending.
  356.  
  357.      When a DOS or Windows session uses a comm port, an additional line of
  358.      signal status appears.  This status line shows the state of the
  359.      virtual UART's signals.  Only the signals which MAY be different from
  360.      the real UART's signals are shown.
  361.  
  362.      "Rx Chars" and "Tx Chars" reflects the number of characters in SIO's
  363.      receive and transmit buffers respectively.
  364.  
  365.      The last line on the screen shows the keys (from the keyboard) that
  366.      PMLM will recognize.  The bright character shows the key to hit for
  367.      the associated function.  The font keys will not work in a windowed
  368.      OS/2 session.
  369.  
  370.      PMLM's command line requires one parameter, the comm port number, and
  371.      optionally accepts an additional parameter giving a save trace file
  372.      name.  For example, PMLM 1 COM1INFO.TEC will monitor COM1 and save ALL
  373.      of the communications traffic in the file COM1INFO.TRC.  The trace
  374.      files created by PMLM contain exactly the same information that is
  375.      displayed by PMLM, video attributes and all.
  376.  
  377.  
  378.  
  379.  
  380.                                                                           5
  381.  
  382.  
  383.      VIEWPMLM.EXE may be used to view trace files created by PMLM. 
  384.      VIEWPMLM.EXE requires one parameter, the trace file name.  The user
  385.      can use the keys UP, DOWN, PAGEUP, PAGEDOWN, HOME, and END to navigate
  386.      the saved trace file.  Registered SIO users may send VIEWPMLM.EXE
  387.      (along with saved trace files) to anyone for technical support
  388.      purposes.
  389.  
  390.      VIEWPMLM can be used in native DOS, in DOS sessions under OS/2, and in
  391.      OS/2 sessions.  This means that even those developers and support
  392.      people need not have OS/2 to view the captured communications data
  393.      created by PMLM.
  394.  
  395.      SIO's Utility (SU.EXE)
  396.  
  397.      This utility program has several useful commands.  You can obtain a
  398.      list of the available commands by typing SU at any command line prompt
  399.      without any parameters.  One very useful command is SU IRQS.  This
  400.      command will show IRQs that currently free for use.  Commands are
  401.      provided allowing user control (missing from MODE) are available. 
  402.      Status commands provide a wealth of diagnostic information.
  403.  
  404.  
  405.  
  406.  
  407.      6
  408.  
  409.                               File System Requests
  410.  
  411.      SIO processes all file system requests made to it in one way or
  412.      another.  The following file system requests and how SIO processes
  413.      them may be of use to the application programmer.
  414.  
  415.      INIT           Driver initialization.
  416.      Read           Data transfer from driver to program.
  417.      Input Status   Get input status.
  418.      Input Flush    Terminate all pending input requests.
  419.      Write          Data transfer from program to driver.
  420.      Output Status  Get output status.
  421.      Output Flush   Terminate all pending output requests.
  422.      Open           Open the device for use.
  423.      Close          Close the device.
  424.      IOCTL          Device I/O control commands.
  425.  
  426.      Each of these file system requests are discussed in more detail in the
  427.      following.
  428.  
  429.                               Driver Initialization
  430.  
  431.      During device driver initialization the command line is parsed, memory
  432.      for data and control buffers is allocated and the system environment
  433.      is examined.
  434.  
  435.      Buffers are allocated for the maximum number of ports that the
  436.      installed version of SIO can support (up to 16).
  437.  
  438.      The mouse port is determined and if it is a serial mouse, that port is
  439.      excluded from use by SIO.
  440.  
  441.      In the absence of any command line parameters, SIO will only support
  442.      (look for) COM1 and COM2 at the standard addresses.  COM3 and up will
  443.      not be supported (or looked at) unless they are specifically
  444.      identified in the SIO command line.
  445.  
  446.                                       Read
  447.  
  448.      If another read is already in progress, the process issuing the
  449.      additional read is blocked (suspended) until the previous read command
  450.      completes.  When a read is started, that read is not interrupted by
  451.      additional reads.  If multiple reads are issued, they are not
  452.      necessarily processed in the order they were issued.  Thus,
  453.      applications may not see the read requests complete in the order in
  454.      which they were issued.
  455.  
  456.      The conditions that control when the read will complete are controlled
  457.      by the active (current) DCB when the read is started.
  458.  
  459.                                   Input Status
  460.  
  461.      This function returns with "device busy" set if there is no data in
  462.      the receive buffer.  That is, busy is returned if the process may be
  463.      blocked if the application issues a read command.
  464.  
  465.  
  466.  
  467.  
  468.                                                                           7
  469.  
  470.                                    Input Flush
  471.  
  472.      This function causes the receive buffer to be cleared (made empty). 
  473.      Any threads that are blocked, waiting for a read, will be restarted
  474.      when this function is issued.
  475.  
  476.  
  477.                                       Write
  478.  
  479.      If another write is already in progress, the process issuing the
  480.      additional write is blocked (suspended) until the previous write
  481.      command completes.  When a write is started, that write is not
  482.      interrupted by additional writes.  If multiple writes are issued, they
  483.      are not necessarily processed in the order they were issued.  Thus,
  484.      applications may not see the write requests complete in the order in
  485.      which they were issued.
  486.  
  487.      The conditions that control when the write will complete are
  488.      controlled by the current DCB when the write is started.
  489.  
  490.  
  491.                                   Output Status
  492.  
  493.      This function returns with "device busy" set if the output buffer is
  494.      more than three quarters full.  That is, busy is returned if the
  495.      process may be blocked if the application issues a write command.
  496.  
  497.                                   Output Flush
  498.  
  499.      This function causes the transmit buffer to be cleared (made empty). 
  500.      Any threads that are blocked, waiting for a write, will be restarted
  501.      when this function is issued.
  502.  
  503.  
  504.                                       Open
  505.  
  506.      There are basically two kinds of open.  They are an Initial Open and
  507.      Additional (shared) Opens. The IBM documentation calls the initial
  508.      open a First Level Open.  An Initial Open is an open that occurs when
  509.      no other process has the communications port open.  An Additional Open
  510.      is when an open occurs and another process already has the
  511.      communications port open.  For an Additional Open to occur, the
  512.      Initial Opener must have issued an open allowing shared access to the
  513.      port.
  514.  
  515.      Initial Open
  516.  
  517.      The IRQ associated with the comm port is claimed (taken) when the
  518.      Initial Open occurs.  If the associated IRQ is not available a "Port
  519.      in Use" error is returned.  At the time of this writing, the IRQ is
  520.      claimed allowing sharing.  However, the shared IRQ claiming is done to
  521.      circumvent anomalies in the OS, and in actuality SIO will not
  522.      concurrently share an IRQ with another device driver.  The author
  523.      found it necessary to claim (reset) all interrupts directed to the
  524.      interrupt service routine in order to prevent lock ups of a
  525.  
  526.  
  527.  
  528.  
  529.      8
  530.  
  531.      communications port.  The IRQ mess may be cleaned up at a future date
  532.      when the OS problems are corrected.
  533.  
  534.      During Initial Opens, DTR and RTS are set in accordance with the
  535.      current Device Control Block (DCB) settings.  If DTR Control Mode is
  536.      the "Enabled" option ( bits 1 and 0 of the DCB Flags1 byte equal 01),
  537.      then DTR is turned on.  Otherwise, DTR is unchanged by the Initial
  538.      Open.  Similarly, if RTS Control Mode is the "Enabled" option ( bits 7
  539.      and 6 of the DCB Flags1 byte equal 01), then RTS is turned on. 
  540.      Otherwise, RTS is unchanged by the Initial Open.
  541.  
  542.      The following actions also occur during an Initial Open:
  543.  
  544.           The Xon and Xoff characters are set to 11h and 13h respectively.
  545.  
  546.           The transmit and receive buffers and structures are cleared and
  547.           re-initialized.
  548.  
  549.           Status bits are reset.
  550.  
  551.      If the Initial Opener is an OS/2 process (not a DOS process) then the
  552.      Read time out processing is set to "Normal" in the current DCB.
  553.  
  554.      Additional Open
  555.  
  556.      A count of active opens is incremented.  No changes are made to
  557.      current comm settings.
  558.  
  559.                                       Close
  560.  
  561.      There are two basic kinds of closes.  They are an Intermediate Close
  562.      and a Last Close.
  563.  
  564.      Intermediate Close
  565.  
  566.      An intermediate close occurs when a process issues a close and other
  567.      processes still have the communications port opened.  This type of
  568.      close simply decrements an open count and returns.  No action or
  569.      changes take place at the communications port.
  570.  
  571.      Last Close
  572.  
  573.      The last close occurs when a process issues a close and no other
  574.      process has the communications port open.  If there are any writes
  575.      pending or incomplete, the process is blocked (suspended) until the
  576.      writes complete or time out.  If 60 seconds pass with no activity at
  577.      the communications port, the port is forced to close and all writes
  578.      are terminated.  If any processes are blocked (suspended) waiting on a
  579.      read, they are forced to return to the process that issued the read.
  580.  
  581.      If either DTR Control Mode or RTS Control Mode are set to "Enabled" by
  582.      the current DCB, then the appropriate signal(s) is turned off.
  583.  
  584.      Finally, the IRQ is released back to the OS.
  585.  
  586.  
  587.  
  588.  
  589.                                                                           9
  590.  
  591.                        Device I/O Control (IOCtl) Commands
  592.  
  593.      The following Generic IOCtl functions are supported by SIO.
  594.           41h - Set Bit Rate
  595.           42h - Set Line Characteristics
  596.           43h - Extended Set Bit Rate
  597.           44h - Transmit Byte Immediate
  598.           45h - Set Break Off
  599.           46h - Set Modem Control Signals
  600.           47h - Hold Transmit
  601.           48h - Start Transmit (after hold)
  602.           4Bh - Set Break On
  603.           53h - Write Device Control Block (DCB) 
  604.           54h - Write Extended Mode Parameters
  605.           61h - Query Current Bit Rate
  606.           62h - Query Line Characteristics
  607.           63h - Query Extended Bit Rate
  608.           64h - Query SIO Status
  609.           65h - Query Transmit Data Status
  610.           66h - Query Current Modem Output Control Signals
  611.           67h - Query Current Modem Input Signals
  612.           68h - Query Number of Characters in Receive Buffer
  613.           69h - Query Number of Characters in Transmit Buffer
  614.           6Dh - Query SIO Error
  615.           72h - Query SIO Event Information
  616.           73h - Read Device Control Block (DCB)
  617.           74h - Read Enhanced Mode Parameters
  618.  
  619.      Each of these IOCtl commands are described in detail on the following
  620.      pages.
  621.  
  622.  
  623.  
  624.  
  625.      10
  626.  
  627.  
  628.      All IOCtl functions are called with a uniform set of parameters.  This
  629.      uniform set of parameters is:
  630.           DWORD     Address of a data packet.
  631.           WORD      Size of the data packet in bytes.
  632.           DWORD     Address of the parameter packet.
  633.           WORD      Size of the parameter packet in bytes.
  634.           WORD      Function code.
  635.           WORD      Category code (01 for SIO).
  636.           WORD      Handle for the opened device. 
  637.  
  638.      Each IOCtl function may or may not have a data or parameter packet. 
  639.      If a given IOCtl function specifies a NULL parameter or data packet,
  640.      the address of the appropriate item must be NULL (zero) in the
  641.      parameters.  Passing an invalid data or parameter packet may result in
  642.      a General Protection Fault.
  643.  
  644.      IOCtl Functions From a DOS Session
  645.  
  646.      Additionally the following describes how to call an IOCtl function in
  647.      an OS/2 driver from a DOS session (VDM).  The "handle" is obtained
  648.      simply by issuing a normal DOS open of the device, ie COM1.  The Data
  649.      Packets (DataPkt below) and Parameter Packets (PrmPkt below) are
  650.      different for each IOCtl function.  The structure and contents of
  651.      these packets are described in the following pages.
  652.  
  653.              push    ds              ;save ds
  654.              mov     bx,handle       ;file handle to bx
  655.              mov     ch,1            ;category, 1=serial device control
  656.              mov     cl,41h          ;func code, 41h=extended set bit rate
  657.              mov     dx,Seg DataPkt  ;get segment of the data packet
  658.              mov     ds,dx           ;load ds with seg of the data packet
  659.              lea     dx,DataPkt      ;data packet address to ds:dx
  660.              mov     si,Seg PrmPkt   ;segment of command packet to si
  661.              lea     di,PrmPkt       ;offset of command packet to di
  662.              mov     ax,440ch        ;IOCtl function call, handle based
  663.              int     21h             ;issue IOCtl to OS/2 driver.
  664.              pop     ds              ;restore ds
  665.              jc      error           ;jump if error returned
  666.  
  667.  
  668.  
  669.  
  670.                                                                          11
  671.  
  672.  
  673.                                41h - Set Bit Rate
  674.  
  675.      Parameter Packet
  676.  
  677.           ┌──────────────────────────────────────┐
  678.           │         Item                Type     │
  679.           ├───────────────────────────┬──────────┤
  680.           │ Bit/Baud Rate             │ WORD     │
  681.           └───────────────────────────┴──────────┘
  682.  
  683.           "Bit Rate" is any number from 1 to 65535.  SIO does not attempt
  684.           to validate a given bit rate.  The minimum bit rate accepted by
  685.           SIO is 50, the maximum for this IOCtl function is 65535.
  686.  
  687.           Note that the hardware may not be able to generate the given bit
  688.           rate.  For example, if a computer has a standard communications
  689.           card installed and if a bit rate of 65500 is specified, the
  690.           nearest bit rate that can be generated will be set, 57600 in this
  691.           case.
  692.  
  693.           To set bit rates in excess of 57600, see IOCtl function 43h,
  694.           Extended Set Bit Rate.
  695.  
  696.           Some commonly used bit rates that can be set with this function
  697.           are:
  698.  
  699.           50        2000
  700.           75        2400
  701.           110       3600
  702.           150       4800
  703.           300       7200
  704.           600       9600
  705.           1200      19200
  706.           1800      28800
  707.           2000      38400
  708.           2400      57600
  709.  
  710.  
  711.      Data Packet - None
  712.  
  713.  
  714.  
  715.  
  716.      12
  717.  
  718.  
  719.                          42h - Set Line Characteristics
  720.  
  721.      Parameter Packet
  722.  
  723.           ┌──────────────────────────────────────┐
  724.           │         Item                Type     │
  725.           ├───────────────────────────┬──────────┤
  726.           │ Data Bits Per Character   │ BYTE     │
  727.           ├───────────────────────────┼──────────┤
  728.           │ Parity Setting            │ BYTE     │
  729.           ├───────────────────────────┼──────────┤
  730.           │ Stop Bit Setting          │ BYTE     │
  731.           └───────────────────────────┴──────────┘
  732.  
  733.           Data Bits Per Character may be 5, 7, or 8, all other values are
  734.           invalid.
  735.  
  736.           Parity Setting may have the following values, all other values
  737.           are invalid:
  738.                0 - No parity bit.
  739.                1 - Odd parity.
  740.                2 - Even parity.
  741.                3 - Mark parity (1).
  742.                4 - Space parity (0).
  743.  
  744.  
  745.           Stop Bit Setting may have the following values, all other values
  746.           are invalid:
  747.                0 - 1 stop bit.
  748.                1 - 1.5 stop bit (valid with 5 data bit characters).
  749.                2 - 2 stop bits.
  750.  
  751.  
  752.      Data Packet - None
  753.  
  754.  
  755.  
  756.  
  757.                                                                          13
  758.  
  759.  
  760.                            43h - Extended Set Bit Rate
  761.  
  762.      Parameter Packet
  763.  
  764.           ┌──────────────────────────────────────┐
  765.           │         Item                Type     │
  766.           ├───────────────────────────┬──────────┤
  767.           │ Bit/Baud Rate             │ DWORD    │
  768.           ├───────────────────────────┼──────────┤
  769.           │ Fraction                  │ BYTE     │
  770.           └───────────────────────────┴──────────┘
  771.  
  772.  
  773.           "Bit Rate" is the desired bit/baud rate.  The maximum bit rate
  774.           supported by SIO is determined by the installed hardware. The
  775.           IOCtl function "63h - Query Extended Bit Rate" can be used to
  776.           determine the maximum bit rate allowed for the associated
  777.           hardware.
  778.  
  779.           SIO does not attempt to validate a given bit rate.  This means
  780.           that the hardware may not be able to generate the given bit rate. 
  781.           For example, if a computer has a standard communications card
  782.           installed and if a bit rate of 65500 is specified, the nearest
  783.           bit rate that can be generated will be set, 57600 in this case.
  784.  
  785.           "Fraction" is used to set the fractional part of the bit rate
  786.           when a high degree of accuracy is needed.  As of this writing,
  787.           SIO does not support a "Fraction" other than zero.
  788.  
  789.           Some commonly used bit rates that can be set with this function
  790.           are:
  791.  
  792.           110       3600      115200
  793.           150       4800      230400
  794.           300       7200
  795.           600       9600
  796.           1200      19200
  797.           1800      28800
  798.           2000      38400
  799.           2400      57600
  800.  
  801.      Data Packet - None
  802.  
  803.  
  804.  
  805.  
  806.      14
  807.  
  808.  
  809.                           44h - Transmit Byte Immediate
  810.  
  811.      Parameter Packet
  812.  
  813.           ┌──────────────────────────────────────┐
  814.           │         Item                Type     │
  815.           ├───────────────────────────┬──────────┤
  816.           │ Character to Transmit     │ BYTE     │
  817.           └───────────────────────────┴──────────┘
  818.  
  819.           "Character to Transmit" will be the next character loaded into
  820.           the UART for transmission.  If a previous transmit immediate byte
  821.           is still pending, it is lost.  This function does not wait for
  822.           the character to transmit before returning.
  823.  
  824.           This function may be used by an application program as one of a
  825.           set of functions to implement its own Xon/Xoff type handshaking.
  826.  
  827.      Data Packet - None
  828.  
  829.  
  830.                                45h - Set Break Off
  831.  
  832.      Parameter Packet - None
  833.  
  834.           Look!! No Parameter Packet!
  835.  
  836.      Data Packet
  837.  
  838.           ┌──────────────────────────────────────┐
  839.           │         Item                Type     │
  840.           ├───────────────────────────┬──────────┤
  841.           │ SIO Error Word            │ WORD     │
  842.           └───────────────────────────┴──────────┘
  843.  
  844.           See function 6Dh "Query SIO Error" for a description of the SIO
  845.           Error Word.  This function does not reset any bits in the SIO
  846.           Error Word.
  847.  
  848.  
  849.  
  850.  
  851.                                                                          15
  852.  
  853.  
  854.                          46h - Set Modem Control Signals
  855.  
  856.      Parameter Packet
  857.  
  858.           ┌──────────────────────────────────────┐
  859.           │         Item                Type     │
  860.           ├───────────────────────────┬──────────┤
  861.           │ DTR and RTS on mask       │ BYTE     │
  862.           ├───────────────────────────┼──────────┤
  863.           │ DTR and RTS off mask      │ BYTE     │
  864.           └───────────────────────────┴──────────┘
  865.  
  866.           Attempted changes in the the setting of signals that are used as
  867.           flow control signals are ignored.  The current DCB determines if
  868.           either or both RTS and DTR are used as a flow control signal.
  869.  
  870.           The setting of bit 0 affects DTR and the setting of bit 1 affects
  871.           RTS.  Ones in the "on mask" specifies which of the two signals
  872.           are to be turned on, and zeros in the "off mask" specify which of
  873.           the two signals are to be turned off.
  874.  
  875.           Some examples are:
  876.                On Mask        Off Mask
  877.                01h            0FFh      Turn DTR on
  878.                00h            0FEh      Turn DTR off
  879.                02h            0FFh      Turn RTS on
  880.                00h            0FDh      Turn RTS off
  881.                03h            0FFh      Turn RTS and DTR on
  882.                00h            0FCh      Turn RTS and DTR off
  883.  
  884.           If both on and off are specified for the setting of a signal, the
  885.           result is undefined.
  886.  
  887.      Data Packet
  888.  
  889.           ┌──────────────────────────────────────┐
  890.           │         Item                Type     │
  891.           ├───────────────────────────┬──────────┤
  892.           │ SIO Error Word            │ WORD     │
  893.           └───────────────────────────┴──────────┘
  894.  
  895.           See function 6Dh "Query SIO Error" for a description of the SIO
  896.           Error Word.  This function does not reset any bits in the SIO
  897.           Error Word.
  898.  
  899.  
  900.  
  901.  
  902.      16
  903.  
  904.  
  905.                                47h - Hold Transmit
  906.  
  907.      Parameter Packet - None
  908.  
  909.      Data Packet - None
  910.  
  911.           This function will disable the transmitter.  The transmitter will
  912.           not be enabled again unless IOCtl function 48h is issued.  If the
  913.           transmitter is already disabled, this call has no effect.
  914.  
  915.           This function can be used as part of a set that allows an
  916.           application to implement its own Xon/Xoff type handshaking.
  917.  
  918.           Note that this is different from how COM.SYS implements this
  919.           function.  COM.SYS will re-enable the transmitter if an Xon is
  920.           received while SIO will not.
  921.  
  922.  
  923.                               48h - Start Transmit
  924.  
  925.      Parameter Packet - None
  926.  
  927.      Data Packet - None
  928.  
  929.           This function will enable the transmitter, usually following an
  930.           IOCtl function 47h.  If the transmitter is already enabled, this
  931.           call has no effect.
  932.  
  933.           This function can be used as part of a set that allows an
  934.           application to implement its own Xon/Xoff type handshaking.
  935.  
  936.  
  937.  
  938.  
  939.                                                                          17
  940.  
  941.  
  942.                                4Bh - Set Break on
  943.  
  944.      Parameter Packet - None
  945.  
  946.           Look!! No Parameter Packet!
  947.  
  948.      Data Packet
  949.  
  950.           ┌──────────────────────────────────────┐
  951.           │         Item                Type     │
  952.           ├───────────────────────────┬──────────┤
  953.           │ SIO Error Word            │ WORD     │
  954.           └───────────────────────────┴──────────┘
  955.  
  956.           See function 6Dh "Query SIO Error" for a description of the SIO
  957.           Error Word.  This function does not reset any bits in the SIO
  958.           Error Word.
  959.  
  960.  
  961.                      53h - Write Device Control Block (DCB) 
  962.  
  963.      This is where the action is!  See also function 73h (Read DCB).
  964.  
  965.      Parameter Packet
  966.  
  967.           ┌──────────────────────────────────────┐
  968.           │         Item                Type     │
  969.           ├───────────────────────────┬──────────┤
  970.           │ Write Timeout             │ WORD     │
  971.           ├───────────────────────────┼──────────┤
  972.           │ Read Timeout              │ WORD     │
  973.           ├───────────────────────────┼──────────┤
  974.           │ Flags1                    │ BYTE     │
  975.           ├───────────────────────────┼──────────┤
  976.           │ Flags2                    │ BYTE     │
  977.           ├───────────────────────────┼──────────┤
  978.           │ Flags3                    │ BYTE     │
  979.           ├───────────────────────────┼──────────┤
  980.           │ Error Replacement Byte    │ BYTE     │
  981.           ├───────────────────────────┼──────────┤
  982.           │ Break Replacement Byte    │ BYTE     │
  983.           ├───────────────────────────┼──────────┤
  984.           │ Xon Character             │ BYTE     │
  985.           ├───────────────────────────┼──────────┤
  986.           │ Xoff Character            │ BYTE     │
  987.           └───────────────────────────┴──────────┘
  988.  
  989.  
  990.           "Write Timeout"  The write timeout is given in hundredths of a
  991.           second, relative to zero.  That is, 0 specifies 0.01 seconds and
  992.           1 specifies 0.02 seconds.
  993.  
  994.           "Read Timeout" The read timeout is given in hundredths of a
  995.           second, relative to zero.  That is, 0 specifies 0.01 seconds and
  996.  
  997.  
  998.  
  999.  
  1000.      18
  1001.  
  1002.           1 specifies 0.02 seconds.
  1003.  
  1004.           "Flags1" is a bit flag.  The bits in the flag specify the
  1005.           following:
  1006.  
  1007.           Bits 1 and 0        DTR Control Mode.
  1008.                     00 - Disable changing DTR during Open and Close.
  1009.                     01 - Enable Changing DTR during Open and Close.
  1010.                     10 - DTR used for input handshaking (not supported by
  1011.                          SIO).
  1012.                     11 - Invalid
  1013.  
  1014.           Bit 2,    Must be zero
  1015.           Bit 3,    Off to ignore CTS.  Forced on if RTS is handshake.
  1016.           Bit 4,    DSR is handshake.  Not supported by SIO.
  1017.           Bit 5,    DCD required to transmit.  Not supported by SIO.
  1018.           Bit 6,    DSR required to receive.
  1019.           Bit 7,    Must be zero.
  1020.  
  1021.      ─────────────────────────────────────
  1022.  
  1023.           "Flags2" is a bit flag.  The bits in the flag specify the
  1024.           following:
  1025.  
  1026.           Bit 0,    SIO is to honor Xon/XOff received from remote.
  1027.           Bit 1,    SIO may send Xon/Xoff to the remote.
  1028.           Bit 2,    Enable error replacement character.  Not supported by
  1029.                     SIO.
  1030.  
  1031.           Bit 3,    Enable null stripping.  Not supported by SIO.
  1032.           Bit 4,    Enable break replacement character.  Not supported by
  1033.                     SIO.
  1034.  
  1035.           Bit 5,    Enable Full duplex.  Half duplex is not supported by
  1036.                     SIO.
  1037.  
  1038.           Bits 7 and 6        RTS Control Mode
  1039.                     00 - Disable changing RTS during Open and Close.
  1040.                     01 - Enable Changing RTS during Open and Close.
  1041.                     10 - RTS used for input handshaking.
  1042.                     11 - Toggle on transmit (half duplex).  Not supported
  1043.                          by SIO.
  1044.  
  1045.  
  1046.  
  1047.  
  1048.                                                                          19
  1049.  
  1050.           "Flags3" is a bit flag.  The bits in the flag specify the
  1051.           following:
  1052.  
  1053.           Bit 0,    Enable infinite write timeout processing.  When set, a
  1054.                     write timeout will not occur.
  1055.  
  1056.           Bits 2 and 1        Read timeout processing
  1057.                     00 - Invalid.
  1058.                     01 - Normal read time out.
  1059.                     10 - Wait for something.  Reads will return before a
  1060.                          timeout occurs if something received.
  1061.                     11 - No Wait.  Reads will return immediately with any
  1062.                          available data.
  1063.  
  1064.           Bits 4 and 3        FIFO Control
  1065.                     00 - No change in FIFO state.
  1066.                     01 - Disable FIFO buffers.
  1067.                     10 - Enable FIFO buffers.
  1068.                     11 - Dynamic enabling and disabling of FIFOS.
  1069.  
  1070.                **Note, SIO forces bits 4 and 3 to "10".
  1071.  
  1072.           Bits 6 and 5        Set receive trigger level
  1073.                     00 - 1 character.
  1074.                     01 - 4 characters.
  1075.                     10 - 8 characters.
  1076.                     11 - 14 characters.
  1077.  
  1078.                **Note, SIO forces bits 6 and 5 to "10".
  1079.  
  1080.           Bit 7               Transmit load count
  1081.                     0 -  Load 1 character.
  1082.                     1 -  Load 16 characters.
  1083.  
  1084.                **Note, SIO forces bit 7 to "1".
  1085.  
  1086.           "Error Replacement Byte" Not supported by SIO.
  1087.  
  1088.           "Break Replacement Byte" Not supported by SIO
  1089.  
  1090.           "Xon Character" Any value, default is 11h.
  1091.  
  1092.           "Xoff Character" Any value, default is 13h.
  1093.  
  1094.      Data Packet - None
  1095.  
  1096.  
  1097.  
  1098.  
  1099.      20
  1100.  
  1101.  
  1102.                       54h - Write Extended Mode Parameters
  1103.  
  1104.      Parameter Packet
  1105.  
  1106.           ┌──────────────────────────────────────┐
  1107.           │         Item                Type     │
  1108.           ├───────────────────────────┬──────────┤
  1109.           │ Enhanced Flags1           │ BYTE     │
  1110.           ├───────────────────────────┼──────────┤
  1111.           │ Reserved                  │ DWORD    │
  1112.           └───────────────────────────┴──────────┘
  1113.  
  1114.           This function is not supported (ignored) by SIO.  However the
  1115.           bits are defined here for completeness.
  1116.  
  1117.           Enhanced Flags1
  1118.           Bit 0 -   Enhanced mode hardware available (Query only 74h).
  1119.           Bit 1 -   Enable enhanced mode.
  1120.           Bits 3 and 2        DMA Receive Operation
  1121.                00 - Disable DMA receive capability.
  1122.                01 - Enable DMA receive capability.
  1123.                10 - Dedicate a DMA channel to receive.
  1124.                11 - Reserved.
  1125.  
  1126.           Bits 5 and 4        DMA Transmit Operation
  1127.                00 - Disable DMA transmit capability.
  1128.                01 - Enable DMA transmit capability
  1129.                10 - Dedicate a DMA channel to transmit.
  1130.                11 - Reserved.
  1131.  
  1132.           Bit 6 -   Receive in DMA mode (Query only, 74h).
  1133.           Bit 7 -   Transmit in DMA mode (Query only, 74h).
  1134.  
  1135.      Data Packet - None.
  1136.  
  1137.  
  1138.  
  1139.  
  1140.                                                                          21
  1141.  
  1142.  
  1143.                           61h - Query Current Bit Rate
  1144.  
  1145.      Parameter Packet - None.
  1146.  
  1147.      Data Packet
  1148.  
  1149.           ┌──────────────────────────────────────┐
  1150.           │         Item                Type     │
  1151.           ├───────────────────────────┬──────────┤
  1152.           │ Bit/Baud Rate             │ WORD     │
  1153.           └───────────────────────────┴──────────┘
  1154.  
  1155.           See function 41h for more information.
  1156.  
  1157.  
  1158.                         62h - Query Line Characteristics
  1159.  
  1160.      Parameter Packet - None.
  1161.  
  1162.  
  1163.      Data Packet
  1164.  
  1165.  
  1166.           ┌──────────────────────────────────────┐
  1167.           │         Item                Type     │
  1168.           ├───────────────────────────┬──────────┤
  1169.           │ Data Bits Per Character   │ BYTE     │
  1170.           ├───────────────────────────┼──────────┤
  1171.           │ Parity Setting            │ BYTE     │
  1172.           ├───────────────────────────┼──────────┤
  1173.           │ Stop Bit Setting          │ BYTE     │
  1174.           ├───────────────────────────┼──────────┤
  1175.           │ Transmitting Break        │ BYTE     │
  1176.           └───────────────────────────┴──────────┘
  1177.  
  1178.           See function 42h for a definition of Data, Parity and Stop Bits.
  1179.  
  1180.           "Transmitting Break" is set to 1 if a break is being transmitted. 
  1181.           Otherwise, it is set to zero.
  1182.  
  1183.  
  1184.  
  1185.  
  1186.      22
  1187.  
  1188.  
  1189.                           63h - Query Extended Bit Rate
  1190.  
  1191.      Parameter Packet - None
  1192.  
  1193.  
  1194.      Data Packet
  1195.  
  1196.           ┌──────────────────────────────────────┐
  1197.           │         Item                Type     │
  1198.           ├───────────────────────────┬──────────┤
  1199.           │ Current Bit/Baud Rate     │ DWORD    │
  1200.           ├───────────────────────────┼──────────┤
  1201.           │ Fraction of Current       │ BYTE     │
  1202.           ├───────────────────────────┼──────────┤
  1203.           │ Minimum Bit/Baud Rate     │ DWORD    │
  1204.           ├───────────────────────────┼──────────┤
  1205.           │ Fraction of Minimum       │ BYTE     │
  1206.           ├───────────────────────────┼──────────┤
  1207.           │ Maximum Bit/Baud Rate     │ DWORD    │
  1208.           ├───────────────────────────┼──────────┤
  1209.           │ Fraction of Maximum       │ BYTE     │
  1210.           └───────────────────────────┴──────────┘
  1211.  
  1212.           "Current Bit/Baud Rate" is a 32 bit integer defining the current
  1213.           bit rate.
  1214.  
  1215.           "Fraction of Current" is always 0 when returned by SIO.
  1216.  
  1217.           "Minimum Bit/Baud Rate" is the minimum value that can be passed
  1218.           to SIO as a bit/baud rate.
  1219.  
  1220.           "Fraction of Minimum" is always 0 when returned by SIO. 
  1221.  
  1222.           "Maximum Bit/Baud Rate" is the maximum value that can be passed
  1223.           to SIO as a bit/baud rate.
  1224.  
  1225.           "Fraction of Maximum" is always 0 when returned by SIO.
  1226.  
  1227.  
  1228.  
  1229.  
  1230.                                                                          23
  1231.  
  1232.  
  1233.                              64h - Query SIO Status
  1234.  
  1235.      Parameter Packet - None
  1236.  
  1237.      Data Packet
  1238.  
  1239.           ┌──────────────────────────────────────┐
  1240.           │         Item                Type     │
  1241.           ├───────────────────────────┬──────────┤
  1242.           │ SIO Status Byte           │ BYTE     │
  1243.           └───────────────────────────┴──────────┘
  1244.  
  1245.           "SIO Status Byte" is a bit flag.  The bits have the following
  1246.           meanings:
  1247.  
  1248.           Bit 0 -   Set if SIO is waiting for CTS before transmitting.
  1249.           Bit 1 -   Set if SIO is waiting for DSR before transmitting.
  1250.           Bit 2 -   Set if SIO is waiting for DCD before transmitting.
  1251.           Bit 3 -   Set if SIO is waiting because Xoff received or
  1252.                     transmitter is disabled (see function 47h).
  1253.  
  1254.           Bit 4 -   Reserved, not used by SIO.
  1255.           Bit 5 -   Set if SIO is waiting because break is being sent.
  1256.           Bit 6 -   Set if a transmit immediate is pending.
  1257.           Bit 7 -   Reserved, not used by SIO.
  1258.  
  1259.  
  1260.  
  1261.  
  1262.      24
  1263.  
  1264.  
  1265.                         65h - Query Transmit Data Status
  1266.  
  1267.      Parameter Packet - None.
  1268.  
  1269.      Data Packet
  1270.  
  1271.           ┌──────────────────────────────────────┐
  1272.           │         Item                Type     │
  1273.           ├───────────────────────────┬──────────┤
  1274.           │ Transmit Status           │ BYTE     │
  1275.           └───────────────────────────┴──────────┘
  1276.  
  1277.           "SIO Status Byte" is a bit flag.  The bits have the following
  1278.           meanings:
  1279.  
  1280.           Bit 0 -   Set if write in progress or pending.
  1281.           Bit 1 -   Set if any data is in the transmit buffer.
  1282.           Bit 2 -   Set if UART is currently transmitting.
  1283.           Bit 3 -   Set if a transmit immediate is pending.
  1284.           Bit 4 -   Set if an Xon needs to be sent.
  1285.           Bit 5 -   Set if an Xoff needs to be sent.
  1286.           Bit 6 -   Reserved
  1287.           Bit 7 -   Reserved
  1288.  
  1289.  
  1290.  
  1291.  
  1292.                                                                          25
  1293.  
  1294.  
  1295.                 66h - Query Current Modem Output Control Signals
  1296.  
  1297.  
  1298.      Parameter Packet - None.
  1299.  
  1300.      Data Packet
  1301.  
  1302.           ┌──────────────────────────────────────┐
  1303.           │         Item                Type     │
  1304.           ├───────────────────────────┬──────────┤
  1305.           │ Modem Output Signals      │ BYTE     │
  1306.           └───────────────────────────┴──────────┘
  1307.  
  1308.           "Modem Output Signals" is a bit flag.  The bits have the
  1309.           following meanings:
  1310.  
  1311.           Bit 0 -   Set if DTR is currently on.
  1312.           Bit 1 -   Set if RTS is currently on.
  1313.           Bits 2-7  Reserved, set to zero by SIO.
  1314.  
  1315.  
  1316.                      67h - Query Current Modem Input Signals
  1317.  
  1318.      Parameter Packet - None.
  1319.  
  1320.      Data Packet
  1321.  
  1322.           ┌──────────────────────────────────────┐
  1323.           │         Item                Type     │
  1324.           ├───────────────────────────┬──────────┤
  1325.           │ Modem Input Signals       │ BYTE     │
  1326.           └───────────────────────────┴──────────┘
  1327.  
  1328.           "Modem Output Signals" is a bit flag.  The bits have the
  1329.           following meanings:
  1330.  
  1331.           Bits 0-3  Reserved, set to zero by SIO.
  1332.           Bit 4 -   Clear To Send (CTS) is active.
  1333.           Bit 5 -   Data Set Ready (DSR) is active.
  1334.           Bit 6 -   Ring Indicator (RI), trailing edge detected.
  1335.           Bit 7 -   Data Carrier Detect (DCD) is active.
  1336.  
  1337.  
  1338.  
  1339.  
  1340.      26
  1341.  
  1342.  
  1343.                68h - Query Number of Characters in Receive Buffer
  1344.  
  1345.      Parameter Packet - None.
  1346.  
  1347.      Data Packet
  1348.  
  1349.           ┌──────────────────────────────────────┐
  1350.           │         Item                Type     │
  1351.           ├───────────────────────────┬──────────┤
  1352.           │ Number of Bytes Buffered  │ WORD     │
  1353.           ├───────────────────────────┼──────────┤
  1354.           │ Byte Size of the Buffer   │ WORD     │
  1355.           └───────────────────────────┴──────────┘
  1356.  
  1357.           Self explaining.
  1358.  
  1359.  
  1360.                69h - Query Number of Characters in Transmit Buffer
  1361.  
  1362.      Parameter Packet - None.
  1363.  
  1364.      Data Packet
  1365.  
  1366.           ┌──────────────────────────────────────┐
  1367.           │         Item                Type     │
  1368.           ├───────────────────────────┬──────────┤
  1369.           │ Number of Bytes Buffered  │ WORD     │
  1370.           ├───────────────────────────┼──────────┤
  1371.           │ Byte Size of the Buffer   │ WORD     │
  1372.           └───────────────────────────┴──────────┘
  1373.  
  1374.           Self explaining.
  1375.  
  1376.  
  1377.  
  1378.  
  1379.                                                                          27
  1380.  
  1381.  
  1382.                               6Dh - Query SIO Error
  1383.  
  1384.  
  1385.      Parameter Packet - None.
  1386.  
  1387.      Data Packet
  1388.  
  1389.           ┌──────────────────────────────────────┐
  1390.           │         Item                Type     │
  1391.           ├───────────────────────────┬──────────┤
  1392.           │ SIO Error Word            │ WORD     │
  1393.           └───────────────────────────┴──────────┘
  1394.  
  1395.           "SIO Error Word" is a bit flag.  The bits have the following
  1396.           meaning:
  1397.  
  1398.           Bit 0 -   Set if a buffer overrun has occurred.
  1399.           Bit 1 -   Set if an overrun occurred at the UART.
  1400.           Bit 2 -   Set if the UART detected a parity error.
  1401.           Bit 3 -   Set if the UART detected a framing error.
  1402.           Bits 4-15 Reserved, set to zero by SIO.
  1403.  
  1404.           All bits of the SIO Error Word are reset prior to returning to
  1405.           the caller.
  1406.  
  1407.  
  1408.  
  1409.  
  1410.      28
  1411.  
  1412.  
  1413.                         72h - Query SIO Event Information
  1414.  
  1415.      Parameter Packet - None.
  1416.  
  1417.      Data Packet
  1418.  
  1419.           ┌──────────────────────────────────────┐
  1420.           │         Item                Type     │
  1421.           ├───────────────────────────┬──────────┤
  1422.           │ SIO Event Word            │ WORD     │
  1423.           └───────────────────────────┴──────────┘
  1424.  
  1425.           "SIO Event Word" is a bit flag.  The bits have the following
  1426.           meaning:
  1427.  
  1428.           Bit 0 -   Set when a receive character is transferred from the
  1429.                     UART to the receive buffer.
  1430.           Bit 1 -   Set when a receive (Read) timeout occurs.
  1431.           Bit 2 -   Set if the transmit buffer is empty.
  1432.           Bit 3 -   Set if Clear To Send (CTS) has changed state.
  1433.           Bit 4 -   Set if Data Set Ready (DSR) has changed state.
  1434.           Bit 5 -   Set if Data Carrier Detect (DCD) has changed state.
  1435.           Bit 6 -   Set if a break has been detected.
  1436.           Bit 7 -   Set if a framing, parity, or overrun error has
  1437.                     occurred.
  1438.           Bit 8 -   Set if trailing edge of Ring Indicator (RI) has
  1439.                     occurred.
  1440.           Bits 9-15 Reserved, set to zero by SIO.
  1441.  
  1442.           All bits are reset prior to returning to the caller.
  1443.  
  1444.  
  1445.  
  1446.  
  1447.                                                                          29
  1448.  
  1449.  
  1450.                       73h - Read Device Control Block (DCB)
  1451.  
  1452.      Parameter Packet - None.
  1453.  
  1454.  
  1455.      Data Packet
  1456.  
  1457.           ┌──────────────────────────────────────┐
  1458.           │         Item                Type     │
  1459.           ├───────────────────────────┬──────────┤
  1460.           │ Write Timeout             │ WORD     │
  1461.           ├───────────────────────────┼──────────┤
  1462.           │ Read Timeout              │ WORD     │
  1463.           ├───────────────────────────┼──────────┤
  1464.           │ Flags1                    │ BYTE     │
  1465.           ├───────────────────────────┼──────────┤
  1466.           │ Flags2                    │ BYTE     │
  1467.           ├───────────────────────────┼──────────┤
  1468.           │ Flags3                    │ BYTE     │
  1469.           ├───────────────────────────┼──────────┤
  1470.           │ Error Replacement Byte    │ BYTE     │
  1471.           ├───────────────────────────┼──────────┤
  1472.           │ Break Replacement Byte    │ BYTE     │
  1473.           ├───────────────────────────┼──────────┤
  1474.           │ Xon Character             │ BYTE     │
  1475.           ├───────────────────────────┼──────────┤
  1476.           │ Xoff Character            │ BYTE     │
  1477.           └───────────────────────────┴──────────┘
  1478.  
  1479.           See function 53h for a description of the parameters.
  1480.  
  1481.  
  1482.                        74h - Read Enhanced Mode Parameters
  1483.  
  1484.      Parameter Packet - None.
  1485.  
  1486.      Data Packet
  1487.  
  1488.           ┌──────────────────────────────────────┐
  1489.           │         Item                Type     │
  1490.           ├───────────────────────────┬──────────┤
  1491.           │ Enhanced Flags1           │ BYTE     │
  1492.           ├───────────────────────────┼──────────┤
  1493.           │ Reserved                  │ DWORD    │
  1494.           └───────────────────────────┴──────────┘
  1495.  
  1496.           See function 54h for a description of the Flags1 Byte.
  1497.  
  1498.  
  1499.  
  1500.  
  1501.      30
  1502.  
  1503.                     Differences between SIO/VSIO and COM/VCOM
  1504.      What follows is some of the differences between SIO/VSIO and COM/VCOM
  1505.      that are known to the author.
  1506.  
  1507.      1 -  COM.SYS will automatically seek out and support four comm
  1508.           ports, COM1 through COM4.  SIO.SYS will automatically seek
  1509.           out and support only COM1 and COM2.  If SIO.SYS is to
  1510.           support more than two comm ports, they must be defined in
  1511.           the command line that loads SIO.SYS.  For example,
  1512.           DEVICE=SIO.SYS (COM3) (COM4) will cause SIO.SYS to support
  1513.           four comm ports.
  1514.  
  1515.      2 -  In the absence of overrides in the command line, COM.SYS
  1516.           will seek out four comm ports in the sequence of I/O ports
  1517.           3F8h, 2F8h, 3E8h and 2E8h.  The first port found in this
  1518.           sequence is given the logical name COM1, the second is COM2
  1519.           etc.  This means that the comm port at 2F8h could become
  1520.           COM1.  In the opinion of the author, this confuses some
  1521.           users to frustration.
  1522.  
  1523.           With no command line overrides, SIO.SYS uses a fixed I/O
  1524.           port concept.  That is, COM1 is always at I/O port 3F8h,
  1525.           COM2 is always at 2F8h, etc.  Another way of looking at this
  1526.           is;  if no comm port exists at port 3F8h, then you do not
  1527.           have a COM1.  SIO.SYS will not move another (found) comm
  1528.           port into the logical COM1 slot.
  1529.  
  1530.      3 -  VSIO opens a comm port for a DOS session with sharing allowed. 
  1531.           VCOM uses an "exclusive use" open for DOS sessions.
  1532.  
  1533.      4 -  SIO.SYS will accept any number from 50 up as a valid baud rate. 
  1534.           For example, if an application program attempts to set a baud
  1535.           rate of 9990 bps, COM.SYS will reject it and SIO.SYS will accept
  1536.           it.
  1537.  
  1538.      5 -  SIO/VSIO execute faster than COM/VCOM.  This means that some
  1539.           applications, that are timing dependent, may not work under
  1540.           SIO/VSIO that do work under COM/VCOM.
  1541.  
  1542.      6 -  SIO/VSIO provides more reliable active flow control for DOS
  1543.           sessions.  For example, if RTS/CTS handshaking is in use, VSIO
  1544.           virtualizes the RTS settings by the DOS program while SIO
  1545.           completely controls the real RTS signal.  COM/VCOM simply passes
  1546.           the RTS signal directly to the hardware.
  1547.  
  1548.      7 -  COM.SYS will block an application until a write completes.  SIO
  1549.           will return to the application program immediately if all of the
  1550.           write data will fit into SIO's internal buffers.
  1551.  
  1552.  
  1553.  
  1554.  
  1555.                                                                          31
  1556.  
  1557.                   Appendix A, Hardware Port and IRQ Assignments
  1558.  
  1559.      I have obtained the following information from various sources. 
  1560.      Accuracy is not guaranteed.  In fact, nothing in this document is
  1561.      guaranteed.
  1562.  
  1563.      Addresses and IRQs for COM1 and COM2
  1564.  
  1565.           COM1 uses 03F8h and IRQ4
  1566.           COM2 uses 02F8h and IRQ3
  1567.  
  1568.      Defacto standard for COM3 and COM4 for PC, XT and AT
  1569.  
  1570.           COM3 uses 03E8h and IRQ4
  1571.           COM4 uses 02E8h and IRQ3
  1572.  
  1573.      Addresses and IRQ for COM3 through COM8 on the PS/2
  1574.  
  1575.           COM3 uses 3220h and IRQ3
  1576.           COM4 uses 3228h and IRQ3
  1577.           COM5 uses 4220h and IRQ3
  1578.           COM6 uses 4228h and IRQ3
  1579.           COM7 uses 5220h and IRQ3
  1580.           COM8 uses 5228h and IRQ3
  1581.  
  1582.      All PCs (known to the author) prior to the PS/2 and EISA only use 10
  1583.      bits to address hardware I/0 ports.  Systems prior to the PS/2 and
  1584.      EISA can not address the standard PS/2 addresses for COM3 through
  1585.      COM8.  If an AT or below attempts to address COM3 through COM8 using
  1586.      the PS/2 addresses, only the low 10 bits of the address are used. 
  1587.      That is, the high 6 bits of the address will be ignored by the
  1588.      hardware.  This means that any reference to COM3 through COM8 will
  1589.      actually address ports 220h through 22Fh on older PCs.
  1590.  
  1591.      One should avoid expansion boards that use ports 220h through 22Fh
  1592.      unless the expansion board is a serial I/O board. 
  1593.  
  1594.      SIO will (attempt to) determine the hardware architecture (ISA/EISA
  1595.      and PS/2) that it is being executed on and use the appropriate
  1596.      hardware port addresses for COM1 thru COM4 as defaults.
  1597.  
  1598.  
  1599.  
  1600.  
  1601.      32
  1602.  
  1603.                               Appendix B, SIO Chips
  1604.  
  1605.  
  1606.      The following is a collection of comments developed from hearsay,
  1607.      random documents, experience, and technical specifications. So, take
  1608.      it with a grain of salt.  Order information from the various
  1609.      manufactures if you want accurate information.
  1610.  
  1611.      Very good reference books are available from National Semiconductor
  1612.      Corporation.  They cover most of the SIO devices (also called UARTs)
  1613.      that you will find in many PCs and clones.  I am not sure that books
  1614.      can be ordered directly from National Semiconductor. They may require
  1615.      that you get it from a distributor.  In any case, the address on the
  1616.      back of the one manual is:
  1617.  
  1618.           National Semiconductor Corporation
  1619.           2900 Semiconductor Drive
  1620.           P.O. Box 58090
  1621.           Santa Clara, CA 95052-8090
  1622.  
  1623.           Tel:(408)721-5000
  1624.           TWX:(910)339-9240
  1625.  
  1626.      8250
  1627.  
  1628.      As best I known, the 8250 was the first SIO chip (integrated circuit)
  1629.      that was used by the IBM PC and many clones.  In my opinion, it was a
  1630.      poor choice on the part of IBM.  I feel many superior devices, at
  1631.      comparable prices, were readily available.  At that time, I feel the
  1632.      8251A or the 8530 would have been better choices.  But, they used the
  1633.      8250 and therefore we must use it.
  1634.  
  1635.      From a hardware standpoint the 8250 is a relatively slow device.  It
  1636.      is advisable that programmers not perform successive inputs or outputs
  1637.      to this device.  It seems that software programs can load the various
  1638.      registers of the 8250 faster than it can process the information.  The
  1639.      8250 had a total of 7 registers.  The specifications state that 56kb
  1640.      is the maximum baud rate.
  1641.  
  1642.      8250A
  1643.  
  1644.      I believe the 8250A is the 8250 with some bug fixes.  I have no idea
  1645.      what the bugs may have been.  A quick glance at the specifications
  1646.      shows the speed of the 8250 and 8250A to be much the same.  The 8250A
  1647.      added an 8th register.  This additional register enables software to
  1648.      detect if an 8250 is installed.  The specifications state that 56kb is
  1649.      the maximum baud rate.
  1650.  
  1651.  
  1652.  
  1653.  
  1654.                                                                          33
  1655.  
  1656.      16450
  1657.  
  1658.      The 16450 seems to be a speeded up version of the 8250A.  There is no
  1659.      direct way (that I know of) for software to detect the difference
  1660.      between an 8250A and a 16450.  I believe the 16450 was developed to
  1661.      eliminate the need for software to insert delays between successive
  1662.      accesses to the device.  The specifications indicate the 16450 is a
  1663.      much faster device than its predecessors.  The additional speed is
  1664.      only the speed at which the processor can access the device.  The
  1665.      maximum baud rate for the 16450 is still stated at 56kb.  However, I
  1666.      have been told by some people that they have run the 16450
  1667.      successfully at much higher speeds. I do not believe there was ever a
  1668.      16450A.
  1669.  
  1670.      16C451
  1671.  
  1672.      The 16C451 is a CMOS version of the 16450.  CMOS is a term for the
  1673.      material and manufacturing process used to make the part.  CMOS
  1674.      typically uses less power than other technologies.  If you are not
  1675.      designing hardware, you should view the 16C451 as a 16450.
  1676.  
  1677.      16550 (Non A)
  1678.  
  1679.      It is hard to find a 16550 (Non A).  I was told by National
  1680.      Semiconductor that they did everything they could to get all 16550s
  1681.      back.  SIO will detect a 16550 and tell you if you have one.  I am
  1682.      told that the 16550 was installed in early PS/2 systems.
  1683.  
  1684.      The 16550 was the first shot at a FIFOed version of the 8250 family
  1685.      from National semiconductor.  However, I was told by National
  1686.      Semiconductor that the FIFOs of the 16550 are not reliable and they
  1687.      should not be enabled.  SIO will treat a 16550 like a 16450.  In this
  1688.      mode, they are reliable.  National Semiconductor would not provide me
  1689.      with a specification for the 16550.  However, I suspect its maximum
  1690.      baud rate is the same as the 16550A which is 256kb.
  1691.  
  1692.      16550A, 16550AF and 16550AFN
  1693.  
  1694.      In the manuals that I have, National Semiconductor does not explain
  1695.      the differences between the 16550A and the 16550AF.  I suspect the AF
  1696.      part may have a few bug fixes.  I believe the N in AFN describes
  1697.      packaging, ceramic versus plastic, DIP versus surface mount etc.
  1698.  
  1699.      In the opinion of the author, there is no substitute for the 16550A
  1700.      (and its successors) in the 8250 type series.  The 16550A is
  1701.      compatible with most software written for the entire family of 8250
  1702.      type devices.  Programs that are 16550A aware can provide much
  1703.      improved performance over previous devices.
  1704.  
  1705.  
  1706.      The maximum baud rate for the 16550A is specified at 256kb.  However,
  1707.      due to the hardware design of the PC et al, 115kb is the maximum baud
  1708.      rate that can be programmed by software.
  1709.  
  1710.      The 16550A can be plugged into the same socket that contains an 8250,
  1711.  
  1712.  
  1713.  
  1714.  
  1715.      34
  1716.  
  1717.      8250A or 16450.  If your SIO expansion board has the SIO chips in
  1718.      sockets, you can upgrade to the 16550A by simply removing the old
  1719.      chips and replacing them with 16550As.
  1720.  
  1721.      The key to the performance increase of the 16550A is its FIFOs.  It
  1722.      has 16 byte FIFOs for both transmit and receive data.
  1723.  
  1724.      16550s Made by Western Digital
  1725.  
  1726.      I have been told, but I have not verified for myself, that 16550s made
  1727.      by Western Digital have a problem with their FIFOs when working at
  1728.      2400 baud or below.
  1729.  
  1730.      16C551
  1731.  
  1732.      The 16C551 is a CMOS version of the 16550AF.  See the above
  1733.      description of the 16C451 for a discussion of CMOS.  Do not feel you
  1734.      need to upgrade from a 16550A or AF to a 16C551.  There is no gain
  1735.      from an existing users point of view.
  1736.  
  1737.      16C552
  1738.  
  1739.      The 16C552 is two 16C551s on a single chip.
  1740.  
  1741.      16C554
  1742.  
  1743.      The 16C554 is four 16C551s on a single chip.
  1744.  
  1745.      82510
  1746.  
  1747.      I believe Intel is the only company that manufactures the 82510.  The
  1748.      82510 is feature rich with several modes of operation.  Its default
  1749.      mode is to operate as a 16450.  The 82510 has a 4 byte FIFO for both
  1750.      transmit and receive data.  A 4 byte FIFO is sufficient to provide
  1751.      significant performance over a basic 16450.
  1752.  
  1753.      The 82510 is small in size.  Therefore, it is found in many lap tops.
  1754.  
  1755.      The 82510 is somewhat of a sleeper.  I believe it would be much more
  1756.      widely used if Intel had promoted it more.  However, given a choice
  1757.      between the 82510 and the 16550A, I would select the 16550A.
  1758.  
  1759.  
  1760.  
  1761.  
  1762.                                                                          35
  1763.  
  1764.  
  1765.      16650
  1766.  
  1767.      The 16650 by Startech seems a good logical step in the evolution of
  1768.      the 8250 type UARTs.  One of the many flavors of the 16650 is a
  1769.      package that is pin compatible with the 40 pin (DIP) 16550s.  This
  1770.      means that the 16650 can be placed into the same socket as any 16550,
  1771.      8250, etc.
  1772.  
  1773.      The 16650 has enhanced the FIFOs to 32 bytes, added on chip flow
  1774.      control ability, and increases the maximum bit rate to 460800.  The on
  1775.      chip flow control is a really nice feature.  On chip flow control
  1776.      practically eliminates the possibility of missed receive characters. 
  1777.      On chip flow control also means that some devices that require
  1778.      immediate attention when it sends Xoff, like the Seiko Label Printer,
  1779.      will work much better in environments like OS/2 and Windows.
  1780.  
  1781.      The 32 byte FIFOs of the 16650 is an improvement over the 16550, but
  1782.      is still a disappointment.  I feel that 1k, or larger, FIFOs would
  1783.      have been a much better choice.  When I quizzed Startech about this,
  1784.      they replied that the 32 byte FIFOs were chosen to keep the cost down. 
  1785.      They added that if the 16650 is successful, they plan a 16750 with
  1786.      larger FIFOs.
  1787.  
  1788.      The 16650 powers up in a 16550 compatible mode, meaning most software
  1789.      written for the 16550 should work.  I have discovered a serious
  1790.      incompatibility in the current (Oct 1994) versions of the 16650.  All
  1791.      previous UARTS in the 8250 family will issue only a single transmit
  1792.      interrupt if no additional data is sent to the UART.  The 16650 on the
  1793.      other hand, will issue continuous transmit interrupts making it
  1794.      necessary to mask the transmit interrupt.  I quizzed Startech about
  1795.      this and was told that a new revision of the chip would be available
  1796.      within a few months that would correct this incompatibility.
  1797.  
  1798.  
  1799.  
  1800.  
  1801.      36
  1802.  
  1803.  
  1804.      ComBic
  1805.  
  1806.      The ComBic is a very impressive UART used on the Hayes ESP card and
  1807.      some others.  The ComBic is basically a 16550 UART with on chip flow
  1808.      control and 1k FIFOs and a maximum bit rate of 921600.   Like the
  1809.      16650, on chip flow control practically eliminates the possibility of
  1810.      missed receive characters.  On chip flow control also means that some
  1811.      devices that require immediate attention when it sends Xoff, like the
  1812.      Seiko Label Printer, will work much better in environments like OS/2
  1813.      and Windows.
  1814.  
  1815.      The ComBic has two modes of operation, compatibility mode and enhanced
  1816.      mode.  In compatibility mode, the UART acts as a 16550.  However, when
  1817.      in compatibility mode, the 1k FIFOs and on chip flow control can still
  1818.      be used.  In enhanced mode, software gains the ability to look into
  1819.      the FIFOs and determine the exact number of bytes loaded.  This
  1820.      feature enables software the use block input and output to the ComBic
  1821.      which greatly reduces processor overhead.
  1822.  
  1823.  
  1824.  
  1825.  
  1826.                                                                          37
  1827.  
  1828.                      Appendix C, Multi-Port Serial I/0 Cards
  1829.  
  1830.      I have received many requests for information about multi-port serial
  1831.      I/O card.  I will describe the boards that I know about (or have heard
  1832.      about) here.  I will add to the list as I receive precise information
  1833.      from manufactures, users, or I develop it myself.
  1834.  
  1835.      Hayes ESP
  1836.  
  1837.      The original ESP (ESP V1) is not supported.  The SIO command line must
  1838.      contain the ESP's enhanced I/O port address.  For bit rates exceeding
  1839.      180000bps the IRQ MUST be specified for the master port. For lower
  1840.      data rates NONE may be specified for the IRQ.  SIO does not search for
  1841.      the ESP ports as the Hayes drivers do under DOS/Windows.  This
  1842.      searching can (will) break things under OS/2.  The SIO command line
  1843.      for an ESP at I/O port 180h using IRQ14 would be as follows:
  1844.  
  1845.      DEVICE=path\SIO.SYS (COM1,180,IRQ14) (COM2,188,NONE)
  1846.  
  1847.      If you would like the above reflected to DOS sessions as a standard
  1848.      COM1 and COM2, then use the following command line:
  1849.  
  1850.      DEVICE=path\SIO.SYS (COM1,180:3F8,IRQ14:IRQ4) (COM2,188:2F8,NONE:IRQ3)
  1851.  
  1852.      Note that the numbers after the colons ":" are the address and IRQ of
  1853.      where the port appears to DOS software running under OS/2.  
  1854.      Any IRQ specified for an ESP slave port is ignored.  For those that
  1855.      like to have a clean looking CONFIG.SYS, SIO will accept NONE as the
  1856.      IRQ specification of an ESP slave port.
  1857.  
  1858.      If you wish to use the ESP in Compatibility Mode, simply specify the
  1859.      base port address that the ESP's compatibility mode is configured for
  1860.      (ie 3F8 when configured for COM1).
  1861.  
  1862.      Telcor Tport
  1863.  
  1864.      The Telcor Tport is supported in both burst mode and 16450 emulation
  1865.      mode.  When in burst mode, the Tport's 16k FIFOs are enabled. 
  1866.      Additionally in burst mode, no IRQ is used by the Tport.  In burst
  1867.      mode, any IRQ specified for the Tport is ignored.  For those that like
  1868.      to have a clean looking CONFIG.SYS, SIO will accept NONE as the IRQ
  1869.      specification of a Tport.  An example command line defining a Tport
  1870.      card to be used in burst mode; and that is configured for COM1
  1871.      follows:
  1872.  
  1873.      DEVICE=path\SIO.SYS (COM1,Tport@3F8,NONE:IRQ4)
  1874.  
  1875.      The Tport's 16450 Emulation mode simply uses a normal SIO command
  1876.      line. eg:
  1877.  
  1878.      DEVICE=path\SIO.SYS (COM1,3F8,IRQ4:IRQ4)
  1879.  
  1880.      In both examples the "IRQ4" following the colon above, means that the
  1881.      virtual IRQs are to be sent to a VDM on IRQ4.
  1882.  
  1883.  
  1884.  
  1885.  
  1886.      38
  1887.  
  1888.      STB 4COM  (ISA bus)
  1889.  
  1890.      I am very impressed with the STB 4COM card, they have almost got it. 
  1891.      Yes, it's the same company that makes the VGA cards.  The 4COM card
  1892.      uses a 16554 which is the equivalent of four 16550A.  Comm ports can
  1893.      use IRQs 2/9, 3, 4, 5, 10, 11, 12, and 15.  Any or all ports can share
  1894.      IRQs, and they have done this right.  I tested SIO with all four ports
  1895.      of the 4COM on IRQ12 and they worked correctly.  The user can select
  1896.      any of the following I/O port address for a comm port: 3F8, 2F8, 3E8,
  1897.      2E8, 1A8, 1E8, 1F8, 2A8.
  1898.  
  1899.      The 4COM card is priced at $110 and I ordered mine from Prerapture
  1900.      Solutions which can be reached by telephone at 1-919-286-1502 for
  1901.      information and foreign callers.  In the US orders can be placed by
  1902.      calling 1-800-735-5266.  Their mailing address is:
  1903.           Prerapture Solutions
  1904.           1806 Albany St.
  1905.           Durham NC 27705-3135
  1906.  
  1907.      Gtek BBS550 (ISA bus)
  1908.  
  1909.      The Gtek BBS550 is a communications card with the equivalent of 8
  1910.      16550s (in reality two 16554s) UARTS.  Where were these cards 5 years
  1911.      ago!  Like the STB 4COM, I am very impressed with the BBS550.  It has
  1912.      a wide range of selectable I/O port address, some in the 16 bit range
  1913.      (above 3FFh) which can be very useful.  I tested the board with all 8
  1914.      ports installed using IRQ3 (although I never had more than 3 ports
  1915.      active at the same time).  The board performed well using shared IRQs.
  1916.  
  1917.      The BBS550 has 8 RJ-45 connectors (10 pin), 6 of which comes directly
  1918.      off the back of the card.  The other two RJ-45 connectors are internal
  1919.      and special cables with grommets are supplier for these 2 ports.  The
  1920.      cables supplied with the BBS550 expands the RJ-45 out to standard DB-
  1921.      25 connectors.
  1922.  
  1923.      Gtek is located in St. Louis Mississippi.  Their phone number is 800-
  1924.      282-4835 or 601-467-8048.
  1925.  
  1926.      Neotech Quad Serial (MCA bus)
  1927.  
  1928.      Well, I just got my first PS/2 system (for testing of SIO) and I am
  1929.      using the NeoTech Quad Serial card in that system.  What can I say, it
  1930.      works beautifully and interrupt sharing has never been a problem on
  1931.      MCA systems.  This card (as shipped) came with four individual 16450
  1932.      chips installed, but they were in sockets so I installed 16550 UARTS
  1933.      before I installed the card.  The card has one large connector on the
  1934.      back of the card and the supplied cable expands that to 4 standard DB-
  1935.      25 connectors.  Those of you needing a 4 port card for an MCA system
  1936.      contact:
  1937.  
  1938.           Neotech Inc
  1939.           30295 Solon Industrial Pkwy.
  1940.           Solon, Ohio 44139
  1941.  
  1942.           Voice     (216) 248-4114
  1943.  
  1944.  
  1945.  
  1946.  
  1947.                                                                          39
  1948.  
  1949.           FAX       (216) 248-5701
  1950.  
  1951.  
  1952.  
  1953.  
  1954.      40
  1955.  
  1956.                         Appendix D, Advanced SIO Options
  1957.  
  1958.  
  1959.      The following is provided for the experienced user.  Inexperienced
  1960.      users get themselves into a lot of trouble when trying to use these
  1961.      options and they cause an inordinate number of support problems.
  1962.      Therefore, the following are unsupported options.  If you use them,
  1963.      you must work out the problems yourself or ask a friend how they got
  1964.      it working.
  1965.  
  1966.      Protection
  1967.  
  1968.      Placing a dash "-" in the fourth parameter position, eg
  1969.      (COM1,3F8,IRQ4,-),  causes SIO not to provide any protection for that
  1970.      port.  The OS may still protect the port somewhat.  When the dash
  1971.      parameter is used the port is wide open (like DOS) for any process to
  1972.      access it.
  1973.  
  1974.      Locked Baud Rate
  1975.  
  1976.      Placing a colon and a baud rate following the communications port, eg
  1977.      (COM1:38400,3F8,IRQ4), causes the port to be locked at that baud rate. 
  1978.      No program, OS2 or DOS, is allowed to change the baud rate.
  1979.  
  1980.      IRQ Reflection to DOS Process
  1981.  
  1982.      Normally the IRQ that is reflected to a DOS process is the same as the
  1983.      actual hardware IRQ.  Placing a colon and an additional IRQ following
  1984.      the normal IRQ, eg (COM1,3F8,IRQ12:IRQ4), causes SIO/VSIO to reflect
  1985.      the IRQ to a DOS process on IRQ4 (in this example) even though the
  1986.      real hardware IRQ is IRQ12.  If one wishes SIO to automatically locate
  1987.      the hardware IRQ, then the following construct can be used:
  1988.      (COM1,3F8,:IRQ4).  Notice that the hardware IRQ is simply NOT
  1989.      specified.
  1990.  
  1991.      I/O Port Mapping to DOS Process
  1992.  
  1993.      Some DOS programs, such as CompuServe's CIM, insist that COM1 be at
  1994.      I/O port 03F8, COM2 at 02F8, etc.  On OS/2 systems, comm ports can
  1995.      have any I/O port address as specified by a command line.  If COM1 is
  1996.      not at I/O port 03F8 for some DOS programs, then COM1 can not be used
  1997.      by the DOS program.  The SIO command line allows the I/O ports to be
  1998.      mapped to a different address for DOS sessions, eg
  1999.      (COM1,FF80:03F8,IRQ12:IRQ4).  In this example, the real COM1 is at
  2000.      FF80 on IRQ12, but is reflected to DOS processes on I/O ports 03F8 at
  2001.      IRQ4.  It is NOT necessary to map both the I/O port address and the
  2002.      IRQ.  When the I/O port is mapped to a DOS session, the UART will
  2003.      appear at BOTH I/O port addresses (FF80 and 03F8 in the given
  2004.      example).
  2005.  
  2006.  
  2007.  
  2008.  
  2009.                                                                          41
  2010.  
  2011.                                       Index
  2012.  
  2013.      16450 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  2014.      16550 (Non A) . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  2015.      16550A  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  2016.      16550AF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  2017.      16550AFN  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  2018.      16550s Made by Western Digital  . . . . . . . . . . . . . . . . . . 34
  2019.      16650 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
  2020.      16C451  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
  2021.      16C551  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
  2022.      16C552  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
  2023.      16C554  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
  2024.      8250  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
  2025.      8250A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
  2026.      82510 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
  2027.      Additional Open . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  2028.      Addresses and IRQ for COM3 through COM8 on the PS/2 . . . . . . . . 31
  2029.      Addresses and IRQs for COM1 and COM2  . . . . . . . . . . . . . . . 31
  2030.      Appendix A, Hardware Notes  . . . . . . . . . . . . . . . . . . . . 31
  2031.      Appendix B, SIO Chips . . . . . . . . . . . . . . . . . . . . . . . 32
  2032.      Appendix C, Multi-Port Serial I/0 Cards . . . . . . . . . . . . . . 37
  2033.      Appendix D, Advanced SIO Options  . . . . . . . . . . . . . . . . . 40
  2034.      BBS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  2035.      Close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  2036.      ComBic  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
  2037.      CompuServe  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  2038.      DCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  6-8
  2039.      Defacto standard for COM3 and COM4  . . . . . . . . . . . . . . . . 31
  2040.      Development and Debugging Tools . . . . . . . . . . . . . . . . . .  4
  2041.      Device Control Block  . . . . . . . . . . . . . . . . . . . . . . .  8
  2042.      Differences between SIO/VSIO and COM/VCOM . . . . . . . . . . . . . 30
  2043.      Distribution  . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  2044.      Driver Initialization . . . . . . . . . . . . . . . . . . . . . . .  6
  2045.      DTR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  2046.      DTR Control Mode  . . . . . . . . . . . . . . . . . . . . . . . . .  8
  2047.      Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  2048.      ESP in Compatibility Mode . . . . . . . . . . . . . . . . . . . . . 37
  2049.      Extended Set Bit Rate . . . . . . . . . . . . . . . . . . . . . . . 13
  2050.      FAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  2051.      FIFO  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33, 34
  2052.      File System Requests  . . . . . . . . . . . . . . . . . . . . . . .  6
  2053.      First Level Open  . . . . . . . . . . . . . . . . . . . . . . . . .  7
  2054.      Gtek BBS550 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
  2055.      Hold Transmit . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
  2056.      I/O Port Mapping to DOS Process . . . . . . . . . . . . . . . . . . 40
  2057.      Initial Open  . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  2058.      Input Flush . . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  2059.      Input Status  . . . . . . . . . . . . . . . . . . . . . . . . . . .  6
  2060.      Intermediate Close  . . . . . . . . . . . . . . . . . . . . . . . .  8
  2061.      IRQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  2062.      IRQ Reflection to DOS Process . . . . . . . . . . . . . . . . . . . 40
  2063.      Last Close  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  2064.      Locked Baud Rate  . . . . . . . . . . . . . . . . . . . . . . . . . 40
  2065.      National Semiconductor Corporation  . . . . . . . . . . . . . . . . 32
  2066.  
  2067.  
  2068.  
  2069.  
  2070.      42
  2071.  
  2072.      Neotech Quad Serial . . . . . . . . . . . . . . . . . . . . . . . . 38
  2073.      Open  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  2074.      Ordering  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  2075.      OS2BVEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  2076.      Output Flush  . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  2077.      Output Status . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  2078.      PCMCIA  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
  2079.      PMLM.EXE  . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  4
  2080.      Protection  . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
  2081.      Query Current Bit Rate  . . . . . . . . . . . . . . . . . . . . . . 21
  2082.      Query Current Modem Input Signals . . . . . . . . . . . . . . . . . 25
  2083.      Query Current Modem Output Control Signals  . . . . . . . . . . . . 25
  2084.      Query Extended Bit Rate . . . . . . . . . . . . . . . . . . . . 13, 22
  2085.      Query Line Characteristics  . . . . . . . . . . . . . . . . . . . . 21
  2086.      Query Number of Characters in Receive Buffer  . . . . . . . . . . . 26
  2087.      Query Number of Characters in Transmit Buffer . . . . . . . . . . . 26
  2088.      Query SIO Error . . . . . . . . . . . . . . . . . . . . . . . . . . 27
  2089.      Query SIO Event Information . . . . . . . . . . . . . . . . . . . . 28
  2090.      Query SIO Status  . . . . . . . . . . . . . . . . . . . . . . . . . 23
  2091.      Query Transmit Data Status  . . . . . . . . . . . . . . . . . . . . 24
  2092.      Read  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  6
  2093.      Read Device Control Block (DCB) . . . . . . . . . . . . . . . . . . 29
  2094.      Read Enhanced Mode Parameters . . . . . . . . . . . . . . . . . . . 29
  2095.      RTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  8
  2096.      RTS Control Mode  . . . . . . . . . . . . . . . . . . . . . . . . .  8
  2097.      Set Bit Rate  . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
  2098.      Set Break Off . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
  2099.      Set Break on  . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
  2100.      Set Line Characteristics  . . . . . . . . . . . . . . . . . . . . . 12
  2101.      Set Modem Control Signals . . . . . . . . . . . . . . . . . . . . . 15
  2102.      SIO Chips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
  2103.      SIO's Utility (SU.EXE)  . . . . . . . . . . . . . . . . . . . . . .  5
  2104.      Start Transmit  . . . . . . . . . . . . . . . . . . . . . . . . . . 16
  2105.      STB 4COM  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
  2106.      Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  2
  2107.      Telcor Tport  . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
  2108.      Transmit Byte Immediate . . . . . . . . . . . . . . . . . . . . . . 14
  2109.      UART  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
  2110.      Updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  3
  2111.      VIEWPMLM.EXE  . . . . . . . . . . . . . . . . . . . . . . . . . . .  5
  2112.      WHAT IS SIO . . . . . . . . . . . . . . . . . . . . . . . . . . . .  1
  2113.      Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  7
  2114.      Write Device Control Block (DCB)  . . . . . . . . . . . . . . . . . 17
  2115.      Write Extended Mode Parameters  . . . . . . . . . . . . . . . . . . 20
  2116.